#pragma once
#include <Windows.h>
#include <cstdint>

typedef struct
{
	uint8_t r;
	uint8_t g;
	uint8_t b;
}color_t;

class ScreenBitmap
{
private:
	HWND hwind;
	HDC hdc;
	HDC hdc2;
	BITMAPINFO info;
	void* data;
	HBITMAP hbitmap;
	int width;
	int high; 
public:
	ScreenBitmap();
	~ScreenBitmap();
	void refresh(void);
	int get_width() const { return width; };
	int get_high() const { return high; };
	void * get_bitmap() { return data; };
	inline color_t get_rgb(int x, int y)
	{
		color_t rgb;
		rgb.r = ((uint8_t*)data)[(high - 1 - y) * width * 3 + x * 3 + 2];
		rgb.g = ((uint8_t*)data)[(high - 1 - y) * width * 3 + x * 3 + 1];
		rgb.b = ((uint8_t*)data)[(high - 1 - y) * width * 3 + x * 3];
		return rgb;
	}
};
